from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from time import sleep
from postion import options
from postion import service

driver = webdriver.Chrome(options=options,service=service)
driver.get(r'https://www.baidu.com/')
driver.maximize_window()
sleep(3)

driver.find_element(By.ID,'s-usersetting-top').click()
driver.find_element(By.LINK_TEXT,'搜索设置').click()
sleep(2)
driver.find_element(By.XPATH,'//*[@id="wrapper"]/div[6]/div/div/ul/li[2]').click()
driver.find_element(By.XPATH,'//*[@id="adv-setting-gpc"]/div/div[1]/span').click()
sleep(2)
# 通过找到父级唯一属性，再定位菜单值
ele=driver.find_element(By.CLASS_NAME,'c-select-dropdown-list')
ele.find_element(By.XPATH,'//*[@id="adv-setting-gpc"]/div/div[2]/div[2]/p[2]').click()
sleep(10)
driver.quit()
